import sys
from PyQt5.QtWidgets import QApplication, QWidget, QMainWindow
from MW1 import Ui_Dialog1
import demo1


class mwindow1(QWidget, Ui_Dialog1):
    def __init__(self):
        super(mwindow1, self).__init__()
        self.setupUi(self)
        self.connecter()
        self.x0 = 0
        self.y0 = 0
        self.x1 = 100
        self.y1 = 100

    def pb(self):
        if self.lineEdit.text().isdigit():
            x0 = int(self.lineEdit.text())
        if self.lineEdit_2.text().isdigit():
            y0 = int(self.lineEdit_2.text())
        if self.lineEdit_3.text().isdigit():
            x1 = int(self.lineEdit_3.text())
        if self.lineEdit_4.text().isdigit():
            y1 = int(self.lineEdit_4.text())
        demo1.Bresenham(self.x0, self.y0, self.x1, self.y1)

    def connecter(self):
        self.pushButton.clicked.connect(self.pb)
        self.pushButton_2.clicked.connect(self.close)



if __name__ == '__main__':
    app = QApplication(sys.argv)
    w = mwindow1()
    w.show()
    sys.exit(app.exec_())